<!DOCTYPE html>
<html>
<head>
    <title>Basic usage</title>

    <link href="../../content/shared/styles/examples-offline.css" rel="stylesheet">
    <link href="../../../styles/kendo.common.min.css" rel="stylesheet">
    <link href="../../../styles/kendo.default.min.css" rel="stylesheet">

    <script src="../../../js/jquery.min.js"></script>
    <script src="../../../js/kendo.web.min.js"></script>
    <script src="../../content/shared/js/console.js"></script>
</head>
<body>
    <a class="offline-button" href="../index.html">Back</a>
    
        <div id="example">

            <div class="configuration k-widget k-header">
                <span class="configHead">Configuration</span>
                <ul class="options">
                    <li><label for="cursorOffset"><input type="checkbox" id="cursorOffset"> Enable <code>cursorOffset</code></label></li>
                    <li><label for="axis">Axis: <select id="axis">
                                <option value="">(none)</option>
                                <option value="x">Horizontal (x)</option>
                                <option value="y">Vertical (y)</option>
                        </select></label></li>
                </ul>
            </div>
            <div id="draggable"></div>
            <div id="droptarget">Start dragging.</div>

            <script>
                function draggableOnDragStart(e) {
                    $("#draggable").addClass("hollow");

                    $("#droptarget").text("(Drop here)");
                }

                function droptargetOnDragEnter(e) {
                    $("#droptarget").text("Now drop...");
                }

                function droptargetOnDragLeave(e) {
                    $("#droptarget").text("(Drop here)");
                }

                function droptargetOnDrop(e) {
                    $("#droptarget").text("You did great!");
                    $("#draggable").removeClass("hollow");
                }

                function draggableOnDragEnd(e) {
                    var draggable = $("#draggable");

                    if (!draggable.data("kendoDraggable").dropped) {
                        // drag ended outside of any droptarget
                        $("#droptarget").text("Try again!");
                    }

                    draggable.removeClass("hollow");
                }

                $(document).ready(function() {
                    $("#draggable").kendoDraggable({
                        hint: function() {
                            return $("#draggable").clone();
                        },
                        dragstart: draggableOnDragStart,
                        dragend: draggableOnDragEnd
                    });

                    $("#droptarget").kendoDropTarget({
                        dragenter: droptargetOnDragEnter,
                        dragleave: droptargetOnDragLeave,
                        drop: droptargetOnDrop
                    });

                    var draggable = $("#draggable").data("kendoDraggable");

                    $("#cursorOffset").click(function(e) {
                        if (this.checked) {
                            draggable.options.cursorOffset = { top: 10, left: 10 };
                        } else {
                            draggable.options.cursorOffset = null;
                        }
                    });

                    $("#axis").change(function(e) {
                        draggable.options.axis = $(this).val();
                    });
                });
            </script>

            <style scoped>
                #draggable
                {
                    cursor: pointer;
                    position: absolute;
                    top: 80px;
                    left: 30px;
                    border: 1px solid #ff8000;
                    width: 78px;
                    height: 78px;
                    border-radius: 37px;
                    box-shadow: 2px 0 10px #9d9d9d;
                    background: #ffcc00 url(../../content/web/dragdrop/draggable.png) 50% 50% no-repeat;
                    background: url(../../content/web/dragdrop/draggable.png) 50% 50% no-repeat, -moz-linear-gradient(top, #ffcc00 0%, #ff8000 100%);
                    background: url(../../content/web/dragdrop/draggable.png) 50% 50% no-repeat, -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffcc00), color-stop(100%,#ff8000));
                    background: url(../../content/web/dragdrop/draggable.png) 50% 50% no-repeat, -webkit-linear-gradient(top, #ffcc00 0%,#ff8000 100%);
                    background: url(../../content/web/dragdrop/draggable.png) 50% 50% no-repeat, -o-linear-gradient(top, #ffcc00 0%,#ff8000 100%);
                    background: url(../../content/web/dragdrop/draggable.png) 50% 50% no-repeat, -ms-linear-gradient(top, #ffcc00 0%,#ff8000 100%);
                    background: url(../../content/web/dragdrop/draggable.png) 50% 50% no-repeat, linear-gradient(top, #ffcc00 0%,#ff8000 100%);
                }

                #draggable.hollow
                {
                    cursor: default;
                    background: #ececec;
                    border-color: #cbcbcb;
                }

                #droptarget
                {
                    border: 1px solid #959595;
                    height: 198px;
                    width: 300px;
                    font-size: 36px;
                    border-radius: 37px;
                    text-align: center;
                    line-height: 198px;
                    color: #a1a1a1;
                    text-shadow: 0 1px 1px #fff;
                    margin: 0 0 30px 220px;
                    cursor: default;

                    background: #dddddd;
                    background: -moz-linear-gradient(top, #dddddd 0%, #c1c1c1 100%);
                    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dddddd), color-stop(100%,#c1c1c1));
                    background: -webkit-linear-gradient(top, #dddddd 0%,#c1c1c1 100%);
                    background: -o-linear-gradient(top, #dddddd 0%,#c1c1c1 100%);
                    background: -ms-linear-gradient(top, #dddddd 0%,#c1c1c1 100%);
                    background: linear-gradient(top, #dddddd 0%,#c1c1c1 100%);
                }

                #example
                {
                    background: url(../../content/web/dragdrop/drag-clue.png) no-repeat 140px 102px;
                }

                #exampleTitle
                {
                    color: #000;
                }
            </style>
        </div>

</body>
</html>
